package com.ruoyi.web.operate.feedback.approval.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.operate.feedback.approval.domain.FeedBackApproval;
import com.ruoyi.web.operate.feedback.approval.service.IFeedBackApprovalService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 反馈审核Controller
 *
 * @author houxuzhong
 * @date 2021-08-26
 */
@RestController
@RequestMapping("/operate/feedback/approval")
public class FeedBackApprovalController extends BaseController
{
    @Autowired
    private IFeedBackApprovalService feedBackApprovalService;

    /**
     * 查询反馈审核列表
     */
    @GetMapping("/list")
    public TableDataInfo list(FeedBackApproval feedBackApproval)
    {
        startPage();
        List<FeedBackApproval> list = feedBackApprovalService.selectFeedBackApprovalList(feedBackApproval);
        return getDataTable(list);
    }

    /**
     * 查询我的反馈审核列表
     */
    @GetMapping("/myList")
    public TableDataInfo myList(FeedBackApproval feedBackApproval) {
        startPage();
        List<FeedBackApproval> list = feedBackApprovalService.selectMyFeedBackList(feedBackApproval);
        return getDataTable(list);
    }

    /**
     * 导出反馈审核列表
     */
    @Log(title = "反馈审核", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FeedBackApproval feedBackApproval)
    {
        List<FeedBackApproval> list = feedBackApprovalService.selectFeedBackApprovalList(feedBackApproval);
        ExcelUtil<FeedBackApproval> util = new ExcelUtil<FeedBackApproval>(FeedBackApproval.class);
        return util.exportExcel(list, "反馈审核数据");
    }

    /**
     * 获取反馈审核详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(feedBackApprovalService.selectFeedBackApprovalById(id));
    }

    /**
     * 新增反馈审核
     */
    @Log(title = "反馈审核", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FeedBackApproval feedBackApproval)
    {
        return toAjax(feedBackApprovalService.insertFeedBackApproval(feedBackApproval));
    }

    /**
     * 修改反馈审核
     */
    @Log(title = "反馈审核", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FeedBackApproval feedBackApproval)
    {
        return toAjax(feedBackApprovalService.updateFeedBackApproval(feedBackApproval));
    }

    /**
     * 删除反馈审核
     */
    @Log(title = "反馈审核", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(feedBackApprovalService.deleteFeedBackApprovalByIds(ids));
    }
}
